<template>
	<div>
		<audio src='../../assets/media/error.wav' hidden='true' ref='errorWavAudioPlay'></audio>
		<audio src='../../assets/media/error.mp3' hidden='true' ref='errorMp3AudioPlay'></audio>
		<audio src='../../assets/media/notexist.mp3' hidden='true' ref='notexistAudioPlay'></audio>
		<audio src='../../assets/media/ok.wav' hidden='true' ref='okAudioPlay'></audio>
		<audio src='../../assets/media/success.mp3' hidden='true' ref='successAudioPlay'></audio>
	</div>
</template>

<script>
	export default {
		name: "audioPlay",
		props: {
			audioValue: {
				type: String ,
				required: true,
			}
		},
		data() {
			return {
				inputValue: 0
			}
		},
		methods: {
			audioPlay(value) {
				if (value == "notexist") {
					this.$refs.notexistAudioPlay.play() // 不存在
					return
				}
				if (value == "ok") {
					this.$refs.okAudioPlay.play() //啾~
					return
				}
				if (value == "error") {
					this.$refs.errorMp3AudioPlay.play() // 出错
					return
				}
				if (value == "success") {
					this.$refs.successAudioPlay.play() //成功
					return
				}
				if (value == "warning") {
					this.$refs.errorWavAudioPlay.play() //打枪

				}
			}
		},
		watch: {
			audioValue: function(val) {
				this.audioPlay(val)
			}
		},
	}
</script>

<style>
</style>
